<?php include THEMES_PATH . 'public/before_body2.phtml'; ?>
<link href="/statics/front/css/product.css" rel="stylesheet">
</head>
<body class="search-page">
<?php include THEMES_PATH . 'public/header2.phtml'; ?>
<?php if($productCount > 0):?>
<!--有结果时-->
<p class="main-width align-center search-result-title"><?php echo $productCount;?> <?php echo $productCount == 1 ? L('search_result_tips') : L('search_results_tips');?> <span class="keyword">'<?php echo $keyword;?>'</span></p>
<?php include THEMES_PATH . 'product/product_list.phtml';?>
<input type="hidden" id="mnumber" name="mnumber" value="<?php echo $jc; ?>"/>
<div class="back-top js-back-top"></div>
<script src="/statics/front/js/plugins/jquery.lazyload.js"></script>

<?php else:?>

<!--无结果时-->
<p class="main-width align-center search-result-title"><?php echo L('empty_search_results_tips');?> <span class="keyword">'<?php echo $keyword;?>'</span></p>
<div class="result-search main-width align-center">
  <p class="search-again"><?php echo L('give_it_one_more_try');?></p>
  <div class="search-wrap">
    <span class="fa fa-search fa-lg"></span>
    <input type="search" class="no-border search-input" maxlength="50" placeholder="<?php echo L('search_again');?>" />
  </div>
  <p class="error" hidden><?php echo L('searchEmpty');?></p>
</div>
<div class="main-width heading">
  <strong><?php echo L('_You_May_Also_Like_');?></strong>
</div>
<div class="ovh rel main-width align-center carousel-box">
  <div class="ovh carousel js-carousel">
    <ul class="rel">
      <?php
        if(isset($productList) && $productList):
          foreach ($productList as $key => $product):
      ?>
      <li>
        <a href="<?php echo $product['url'];?>">
          <img src="<?php echo $product['goods_img']?>">
          <?php if(!empty($product['ml_img'])){ ?>
          <img src="<?php echo $product['ml_img']?>" class="hide">
          <?php } ?>
        </a>
        <p>
          <a href="<?php echo $product['url'];?>"><?php echo $product['name'];?></a>
        </p>
        <p>
          <?php
            if($product['attribute_type']==2){
                if($product['product_type']){
                    echo currency($product['sell_price']);
                }else{
                    echo currency($product['advanced_price']);
                }
            }elseif($product['attribute_type']==1){
                echo currency($product['custom_price']);
            }
          ?>
        </p>
      </li>
      <?php
          endforeach;
        endif;
      ?>
    </ul>
  </div>
  <span class="fa fa-2x fa-chevron-left carousel-control-prev js-carousel-control-prev"></span>
  <span class="fa fa-2x fa-chevron-right carousel-control-next js-carousel-control-next"></span>
</div>
<?php endif;?>

<!-- build:js /statics/front/pkg/js/carousel.js -->
<script src="/statics/front/js/plugins/carousel/jquery.jcarousel.min.js"></script>
<script src="/statics/front/js/plugins/carousel/jquery.jcarousel-swipe.min.js"></script>
<script src="/statics/front/js/scripts/carousel-list.js"></script>
<!-- endbuild -->
<script>
$(function () {
    /*全站搜索*/
    var searchWrap = $(".result-search .search-wrap"),
        searchInput = searchWrap.find(".search-input"),
        searchIcon = searchWrap.find(".fa-search"),
        error = searchWrap.siblings(".error"),
        searchHotWords = $(".search-hot-words");

    /*输入框获得焦点*/
    searchInput.on({
        "blur": function(){
            error.hide();
        },
        "focus": function(){
            //console.log("input focus")
        },
        "keyup": function (e) {
            error.hide();
            if(e.keyCode == 13){
                searchHotWords.hide();
                if(!$.trim(searchInput.val())){
                    error.show();
                }else{
                    /*显示结果列表页*/
                    var keyword = searchInput.val();
                    keyword=keyword.replace( /^\s+/, "" );
                    keyword=keyword.replace( /\s+$/, "" );
                    keyword=keyword.replace(/\s/g, "+");
                    window.location.href = url('product/search')+'keyword/'+keyword;
                }
            }
        }
    });
});
</script>
<?php include THEMES_PATH . 'public/footer2.phtml';?>
<?php include THEMES_PATH . 'public/after_body.phtml';?>